package jp.aist.gtrc.plus.admission.EDF;

import java.util.*;

class LoadComparator implements Comparator {
   public int compare(Object o1, Object o2) {
      int diff = 0;
      CPU cpu1 = (CPU) o1;
      CPU cpu2 = (CPU) o2;
      if (cpu1.lastOccupied < cpu2.lastOccupied) 
         diff = -1;
      else if (cpu1.lastOccupied > cpu2.lastOccupied)
         diff = 1; 
      if (diff == 0) {
         diff = cpu1.id.compareTo(cpu2.id);
      }
      return diff;
   }

}
